<template>
<div class="common-body-wrapper">
  <search-header single-width="130" :searchList="searchList" @changeHeight="toRetTable" @confirmSearch="toSearch" @handleChange="handleSearchChange" :isNeedTree="true" :isCheckbox="true" :paramName="paramName" @setSelectedNode="setSelectedNode"></search-header>
  <div class="common-table-tree-wrapper">
    <div class="common-table-wrapper">
      <multi-fun-table :sortColumn='notFormatColumn' :orderType='sortType' :fixed-cols="fixedCols" :is-reset-table="isResetTable" :theads-info="theadsInfo" :tbodys-info="tbodysInfo" @handleMultiCheck="handleMultiCheck" @handleSortColumn="handleSortColumn" @searchFn="getList" @getNextPage="getNextPage">
        <!--按钮-->
        <div class="operate-btn-group" slot="operateBtnGroup">
          <a class="ake_btn ake_btn_text" @click.prevent="exportReport()">导出</a>
        </div>

        <!--普通列-->
        <template slot="tdCell" slot-scope="props">
          <el-table-column :fixed="props.fixed" :label="props.label" :min-width="props.minWidth" :width="props.width" :prop="props.prop" :sortable="props.sortable">
            <template slot-scope="scope">
              <span v-if="'reno' == props.prop">
                <span v-if="!scope.row.parkName">
                  合计
                </span>
                <span v-else>
                  {{ scope.$index}}
                </span>
              </span>
              <span v-else-if="'parkList' == props.prop">
                <a class="imgLink" @click="ParkListModal_open(scope.row)">
                  查看({{scope.row.parkList.length}})
                </a>
              </span>
              <span v-else>{{ scope.row[props.prop] }}</span>
            </template>
          </el-table-column>
        </template>

      </multi-fun-table>

      <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
    </div>
  </div>
</div>
</template>

<script>
import common from '@mixins/common.js'
import stardardList from '@mixins/tables/stardardList.js'

//modal
import invokeModal from '@mixins/modal/invokeModal.js'

// 引进vue的js
import User from './js/mobile_report.js'

export default {
  name: 'mobileReport',
  mixins: [common, stardardList, invokeModal, User],
  data() {
    var today = [new Date(moment().subtract('days', 1).format("YYYY-MM-DD 00:00:00")), new Date(moment().subtract('days', 1).format("YYYY-MM-DD 23:59:59"))]; //昨天
    return {
      paramName: 'query_parkId',
      total: 0,
      fixedCols: 0,
      searchList: [
        {
          index: 0,
          isShow: false,
          type: 'select',
          name: 'query_timeDim',
          text: '时间维度',
          value: 'DATE',
          isHandleChange: true,
          options: [{
              name: '日报',
              value: 'DATE'
            },
            {
              name: '月报',
              value: 'MONTH'
            },
            {
              name: '年报',
              value: 'YEAR'
            }
          ]
        },
        {
          index: 1,
          format: "yyyy-MM-dd",
          isShow: false,
          type: 'datePicker',
          pickerType: "daterange",
          name: 'dateFromTo',
          text: '时间区间',
          propName: 'query_statTimeStart,query_statTimeEnd',
          value: today,
          style: {
            width: '360px'
          }
        },
      ],
      theadsInfo: [{
          index: 0,
          isShow: false,
          prop: 'reno',
          text: '序号',
          width: 68
        },
        {
          index: 1,
          isShow: false,
          prop: 'reportDateFormat',
          text: '日期',
          minWidth: 150
        },
        {
          index: 2,
          isShow: false,
          prop: 'parkName',
          text: '停车场',
          minWidth: 150
        },
        {
          index: 3,
          isShow: false,
          prop: 'checkCount',
          text: '盘点次数',
          minWidth: 110
        },
        {
          index: 4,
          isShow: false,
          prop: 'eventCount',
          text: '事件次数',
          minWidth: 110
        },
        {
          index: 5,
          isShow: false,
          prop: 'violateCount',
          text: '违规次数',
          minWidth: 110
        },
        {
          index: 6,
          isShow: false,
          prop: 'emergencyInCount',
          text: '异常进场次数',
          minWidth: 110
        },
        {
          index: 7,
          isShow: false,
          prop: 'emergencyOutCount',
          text: '异常出场次数',
          minWidth: 110
        }
      ],
      tbodysInfo: []
    }
  }
}
</script>

<style lang="less">
.user-row-modal {
  .first-item {
    width: 240px;
  }
}

//调整transfer的样式
.user-transfer-modal {
  .modal-body {
    margin: 0 auto;
  }

  .el-checkbox+.el-checkbox {
    margin-left: 0;
  }

  .el-button+.el-button {
    margin-left: 0;
  }
}

.role-select {
  width: 240px;
}
</style>
